from selenium import webdriver
import os
os.system("taskkill /F /IM firefox.exe")
dr=webdriver.Firefox()
dr.get("http://192.168.2.180:8080/woniusales_3/")
#  #id
# dr.find_element_by_css_selector("#username").send_keys("admin")

# .class  tag name
# dr.find_element_by_css_selector("form.form-inline input").send_keys("admin")
# .class  tag name
# dr.find_element_by_css_selector(".form-inline input").send_keys("admin")

# AAA:BBB  XXX>YYY>ZZZ
# dr.find_element_by_css_selector("form.form-inline>div:nth-child(3)>input").send_keys("admin")

# [prop='value'] p=v 完全匹配
# dr.find_element_by_css_selector('input[onkeypress="doLogin(event)"]').send_keys("0000")

# [prop='value'] p^=v 头匹配
# dr.find_element_by_css_selector('input[type^="pass"]').send_keys("admin")

# [prop='value'] p$=v 尾匹配
# dr.find_element_by_css_selector('input[type$="word"]').send_keys("admin")

# [prop='value'] p*=v 包含匹配
# dr.find_element_by_css_selector('input[type*="ss"]').send_keys("admin")

# AAA:BBB  XXX>YYY>ZZZ
# dr.find_element_by_css_selector("form.form-inline>div:last-child>button").click()

#xpath
#绝对路径
# dr.find_element_by_xpath("/html/body/div[4]/div/form/div[2]/input").send_keys("admin")
#相对路径
# dr.find_element_by_xpath("//input").send_keys("admin")
# 指定位置
# dr.find_element_by_xpath("//input[1]").send_keys("admin")
# dr.find_element_by_xpath("//form/div[3]/input").send_keys("admin")
# 指定属性
# dr.find_element_by_xpath('//input[@type="password"]').send_keys("admin")
# 懒人模式
# dr.find_element_by_xpath("/html/*/*/*/*/*/input").send_keys("admin")
